package servlets;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import mail.*;

@WebServlet(name="MailServlet", urlPatterns="/Mail.do")
public class MailServlet extends HttpServlet   {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */

	public MailServlet() {
		super();
		// TODO Auto-generated constructor stub
	}

	protected void doGet(HttpServletRequest req, HttpServletResponse response) 
			throws ServletException, IOException {
		String ontvanger = req.getParameter("ontvanger"); 
		String onderwerp = req.getParameter("onderwerp");
		String tekst = req.getParameter("tekst");
		SendMail s = new SendMail("os@hu.nl", ontvanger, onderwerp, tekst);
		s.send();
		response.sendRedirect("index.jsp?message=Mail+verzonden");
	}

}


